package io.coderyeah.basic.util;

import io.coderyeah.user.domain.LoginInfo;

/**
 * 使用threadLocal存储当前用户登录对象
 * 实现数据隔离
 */
public class LoginInfoHolder {
    private static final ThreadLocal<LoginInfo> LOCAL = new ThreadLocal<>();

    public static void set(LoginInfo loginInfo) {
        LOCAL.set(loginInfo);
    }

    public static LoginInfo get() {
        return LOCAL.get();
    }

    public static void remove() {
        LOCAL.remove();
    }
}